﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using SocialShare.BusinessEntities;
using SocialShare.DAL.Facades;

public partial class Admin_manage_forum_categories : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    [WebMethod]
    public static Int32 CreateCategory(String catName)
    {
        SocialShare_Forum_Categories forumcategory = new SocialShare_Forum_Categories();
        forumcategory.CategoryName = catName;
        forumcategory.DateCreated = DateTime.Now;

        ForumFacade forumFacade = new ForumFacade();
        return forumFacade.CreateNewForumCategory(forumcategory);

    }

    [WebMethod]
    public static void UpdateCategory(String catName, Int32 catId)
    {
        ForumFacade forumFacade = new ForumFacade();
        SocialShare_Forum_Categories forumcategory = forumFacade.GetForumCategoryById(catId);
        if (forumcategory != null)
        {
            forumcategory.CategoryName = catName;
            forumFacade.UpdateForumCategory(forumcategory);
        }       

    }
}